furny.ga.logger
Class GACSVLogger

java.lang.Object
  extended by furny.ga.logger.GACSVLogger
All Implemented Interfaces:
IGALogger<FurnLayoutIndividual>

public class GACSVLogger
extends java.lang.Object
implements IGALogger<FurnLayoutIndividual>

GA logger that outputs informations to a CSV file.

Since:
11.08.2012
Author:
Stephan Dreyer

Field Summary
private  java.lang.String csvFileName
           
private  java.util.List<double[]> data
           
private static java.lang.String DEFAULT_FILE
           
 
Constructor Summary
GACSVLogger()
          Creates a new CSV logger that writes to the default file.
GACSVLogger(java.lang.String csvFileName)
          Creates a new CSV logger that writes to the given file.
 
Method Summary
 void allIndividualsEvaluated(int generation, IPopulation<FurnLayoutIndividual> population)
          Notifies about the population that has been evaluated.
 void evaluationStarted()
          Notifies about the start of the evaluation.
 void exit()
          Notifies about the termination of the algorithm.
 void individualEvaluated(int generation, FurnLayoutIndividual individual)
          Notifies about an individual that has been evaluated.
 void individualsCrossed(int generation, IndividualList<FurnLayoutIndividual> list)
          Notifies about individuals that have been crossed.
 void individualSelectedForEvaluation(int generation, FurnLayoutIndividual individual)
          Notifies about an individual that has been selected for evaluation.
 void individualsInserted(int generation, IndividualList<FurnLayoutIndividual> list, IPopulation<FurnLayoutIndividual> population)
          Notifies about individuals that have been inserted into the population.
 void individualsMutated(int generation, IndividualList<FurnLayoutIndividual> list)
          Notifies about individuals that have been mutated.
 void individualsSelected(int generation, IndividualList<FurnLayoutIndividual> list)
          Notifies about individuals that have been selected.
 void populationInitiated(int generation, IPopulation<FurnLayoutIndividual> population)
          Notifies about the initialization of the population.
private static void writeCSV(double[][] data, java.lang.String filename)
          Writes the data array to the CSV file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILE

private static final java.lang.String DEFAULT_FILE
See Also:
Constant Field Values

data

private final java.util.List<double[]> data

csvFileName

private final java.lang.String csvFileName
Constructor Detail

GACSVLogger

public GACSVLogger()
Creates a new CSV logger that writes to the default file.

Since:
11.08.2012

GACSVLogger

public GACSVLogger(java.lang.String csvFileName)
Creates a new CSV logger that writes to the given file.

Parameters:
csvFileName - The CSV file name.
Since:
11.08.2012
Method Detail

evaluationStarted

public void evaluationStarted()
Description copied from interface: IGALogger
Notifies about the start of the evaluation.

Specified by:
evaluationStarted in interface IGALogger<FurnLayoutIndividual>

populationInitiated

public void populationInitiated(int generation,
                                IPopulation<FurnLayoutIndividual> population)
Description copied from interface: IGALogger
Notifies about the initialization of the population.

Specified by:
populationInitiated in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
population - The population that has been initialized.

individualsSelected

public void individualsSelected(int generation,
                                IndividualList<FurnLayoutIndividual> list)
Description copied from interface: IGALogger
Notifies about individuals that have been selected.

Specified by:
individualsSelected in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
list - The list of selected individuals.

individualsCrossed

public void individualsCrossed(int generation,
                               IndividualList<FurnLayoutIndividual> list)
Description copied from interface: IGALogger
Notifies about individuals that have been crossed.

Specified by:
individualsCrossed in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
list - The list of crossed individuals.

individualsMutated

public void individualsMutated(int generation,
                               IndividualList<FurnLayoutIndividual> list)
Description copied from interface: IGALogger
Notifies about individuals that have been mutated.

Specified by:
individualsMutated in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
list - The list of mutated individuals.

individualsInserted

public void individualsInserted(int generation,
                                IndividualList<FurnLayoutIndividual> list,
                                IPopulation<FurnLayoutIndividual> population)
Description copied from interface: IGALogger
Notifies about individuals that have been inserted into the population.

Specified by:
individualsInserted in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
list - The list individuals that have been inserted.
population - The population where the individuals have been inserted.

allIndividualsEvaluated

public void allIndividualsEvaluated(int generation,
                                    IPopulation<FurnLayoutIndividual> population)
Description copied from interface: IGALogger
Notifies about the population that has been evaluated.

Specified by:
allIndividualsEvaluated in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
population - The population that has been evaluated.

individualSelectedForEvaluation

public void individualSelectedForEvaluation(int generation,
                                            FurnLayoutIndividual individual)
Description copied from interface: IGALogger
Notifies about an individual that has been selected for evaluation.

Specified by:
individualSelectedForEvaluation in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
individual - The selected individual.

individualEvaluated

public void individualEvaluated(int generation,
                                FurnLayoutIndividual individual)
Description copied from interface: IGALogger
Notifies about an individual that has been evaluated.

Specified by:
individualEvaluated in interface IGALogger<FurnLayoutIndividual>
Parameters:
generation - The current generation.
individual - The evaluated individual.

exit

public void exit()
Description copied from interface: IGALogger
Notifies about the termination of the algorithm. The logger must shut down, too.

Specified by:
exit in interface IGALogger<FurnLayoutIndividual>

writeCSV

private static void writeCSV(double[][] data,
                             java.lang.String filename)
Writes the data array to the CSV file.

Parameters:
data - The data array.
filename - The CSV file.
Since:
11.08.2012